package com.hxci.zhangcong.servcie;

import com.hxci.zhangcong.dao.CourseMapper;
import com.hxci.zhangcong.pojo.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CorseServiceImp implements CorseService{
    @Autowired
    CourseMapper mapper;

    @Override
    public List<Course> query(Course  course) {
        return mapper.query(course);
    }

    @Override
    public Integer del(String id) {
        return mapper.del(id);
    }

    @Override
    public Integer save(Course course) {
        if(course.getId() != null){
            return mapper.update(course);
        }else {
            return mapper.save(course);
        }

    }

    @Override
    public Course queryBySno(String sno) {
        return mapper.queryBySno(sno);
    }

    @Override
    public List<Course> queryByTeacher(String teacher) {
        return mapper.queryByTeacher(teacher);
    }
}
